﻿<DemoContainer>
    <ApexChart TItem="Order"
               Title="Fill Sample"
               Options=options>

        <ApexPointSeries TItem="Order"
                         Items="orders"
                         SeriesType="@SeriesType.Area"
                         Name="Gross Value"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.GrossValue))"
                         OrderByDescending="e=>e.Y" ShowDataLabels />

        <ApexPointSeries TItem="Order"
                         Items="orders"
                         SeriesType="@SeriesType.Area"
                         Name="Net Value"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.NetValue))"
                         OrderByDescending="e=>e.Y" />
    </ApexChart>
</DemoContainer>
@code {
    private List<Order> orders = SampleData.GetOrders();
    private ApexChartOptions<Order> options = new ApexChartOptions<Order>();

    protected override void OnInitialized()
    {
        options.Colors = new List<string> { "#32F16C", "#F13232" };

        options.Fill = new Fill
            {
                Type = new List<FillType> { FillType.Gradient, FillType.Gradient },
                Gradient = new FillGradient
                {
                    ShadeIntensity = 1,
                    OpacityFrom = 0.2,
                    OpacityTo = 0.9,

                }
            };

        options.Yaxis = new List<YAxis>();
        options.Yaxis.Add(new YAxis
            {
                Labels = new YAxisLabels
                {
                    Formatter = @"function (value, index, w) {
                    return Number(value).toLocaleString();}"
                }
            }
        );
    }
    }
